<!--
 * @version: 
 * @Author: yu
 * @Date: 2023-06-26 16:27:23
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-01 20:09:58
-->
<template>
    <div>
        <el-button class="mt20 mb20" type="primary" size="medium" @click="add">添加</el-button>

        <!-- 列表渲染 -->
        <list @edit="edit"></list>

        <!-- 弹窗 -->
        <v-dialog ref="dialog" :info="info"></v-dialog>
    </div>
</template>
<script>
import list from './list.vue'
import vDialog from './dialog.vue'
export default {
    data() {
        return {
            info: {
                isShow: false,
                title: '',
                isAdd: true
            }
        }
    },
    methods: {
        //添加
        add() {
            this.info.isShow = true
            this.info.title = '商品分类添加'
            this.info.isAdd = true
        },
        //编辑
        edit(id) {
            // console.log(id);
            this.info.isShow = true
            this.info.title = '商品分类编辑'
            this.info.isAdd = false
            this.$refs.dialog.getDetail(id)
        }
    },
    mounted() {
        document.title = this.$route.meta.title
    },
    watch: {},
    computed: {},
    filters: {},
    components: {
        list,
        vDialog
    }
}
</script>
<style scoped></style>